function calculate() {
  let g = 9.8
  let input1 = parseFloat(document.getElementById("input1").value);   //m1
  let input2 = parseFloat(document.getElementById("input2").value);   //m2
  let input3 = parseFloat(document.getElementById("input3").value);  //φ1
  let input4 = parseFloat(document.getElementById("input4").value);  //k1
  let input5 = parseFloat(document.getElementById("input5").value);   //s1
  let input6 = parseFloat(document.getElementById("input6").value);   //s2
  let input7 = parseFloat(document.getElementById("input7").value);  //f2
  let input8 = parseFloat(document.getElementById("input8").value);  //x2

  if (!input1 ) input1  = 0;
  if (!input2 ) input2  = 0;
  if (!input3 ) input3  = 0;  
  if (!input4 ) input1  = 0;
  if (!input5 ) input2  = 0;
  if (!input6 ) input3  = 0;
  if (!input7 ) input1  = 0;
  if (!input8 ) input2  = 0;

  console.log("input1=",input1)
  console.log("input2=",input2)

  //v1的结果
  let result = (Math.sqrt(2*g*(input3*input1*input5*input4+input7*input2*input6)/(input1+input2))*3.6+input2*(2*17.9*input8/(input1+input2)+4.6/input1));
 //v2的结果
 let result1 = (Math.sqrt(2*g*(input3*input1*input5*input4+input7*input2*input6)/(input1+input2))*3.6-2*17.9*input1*input8/(input1+input2)-4.6);


  if (result == 'NaN') {
    result = 0
    alert('请按要求输入数据！')
    location.reload()
  }
  //v1的结果
  document.getElementById("result").textContent = result.toFixed(2);
   //v2的结果
  document.getElementById("result1").textContent = result1.toFixed(2);

}